package com.jeesite.modules.customer.service;

import java.util.List;

import com.jeesite.common.utils.OrgUtil;
import com.jeesite.modules.customer.entity.qo.CustomerQO;
import com.jeesite.modules.customer.entity.vo.CustomerVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.customer.entity.Customer;
import com.jeesite.modules.customer.dao.CustomerDao;

/**
 * 客户档案Service
 * @author 码脑洞
 * @version 2025-04-21
 */
@Service
public class CustomerService extends CrudService<CustomerDao, Customer> {
	
	/**
	 * 获取单条数据
	 * @param customer
	 * @return
	 */
	@Override
	public Customer get(Customer customer) {
		return super.get(customer);
	}
	
	/**
	 * 查询分页数据
	 * @param customer 查询条件
	 * @param customer page 分页对象
	 * @return
	 */
	@Override
	public Page<Customer> findPage(Customer customer) {
		return super.findPage(customer);
	}
	
	/**
	 * 查询列表数据
	 * @param customer
	 * @return
	 */
	@Override
	public List<Customer> findList(Customer customer) {
		return super.findList(customer);
	}
	
	/**
	 * 保存数据（插入或更新）
	 * @param customer
	 */
	@Override
	@Transactional
	public void save(Customer customer) {
		super.save(customer);
	}
	
	/**
	 * 更新状态
	 * @param customer
	 */
	@Override
	@Transactional
	public void updateStatus(Customer customer) {
		super.updateStatus(customer);
	}
	
	/**
	 * 删除数据
	 * @param customer
	 */
	@Override
	@Transactional
	public void delete(Customer customer) {
		super.delete(customer);
	}

	public Page<CustomerVO> findCustomerPage(CustomerQO customerQO) {
		Page<CustomerVO> page = customerQO.getPage();
		customerQO.setOrgId(OrgUtil.getOrgId());
		page.setList(dao.findCustomerPage(customerQO));
		return page;
	}

}